using Engine;
using Engine.Graphics;
using Game;

namespace SCIENEW {
    /// 带有DisplayName, Description的普通方块
    public class DefaultNBlock : NormalBlock {
        public Color Color;

        public Texture2D Texture;

        public string DisplayName = string.Empty, Description = string.Empty, Id = string.Empty;

        public int FaceTextureSlot;

        public DefaultNBlock(string id) {
            Id = id;
            try {
                DisplayName = LanguageControl.Get("NormalBlocks", "Names", GetCraftingId());
                Description = LanguageControl.Get("NormalBlocks", "Descriptions", GetCraftingId());
            }
            catch (NullReferenceException) {
            }
        }

        public override string GetCraftingId() => Id;

        public override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) => DisplayName;

        public override string GetDescription(int value) => Description;

        public override Color GetColor(int value) => Color;

        public override Texture2D GetTexture(int value) => Texture;

        public override int GetFaceTextureSlot(int face, int value) => FaceTextureSlot;
        
        public override BlockDebrisParticleSystem CreateDebrisParticleSystem(SubsystemTerrain subsystemTerrain, Vector3 position, int value, float strength) {
            return new BlockDebrisParticleSystem(
                subsystemTerrain,
                position,
                1,
                1,
                Color,
                FaceTextureSlot,
                Texture
            );
        }

        public DefaultNBlock(string id, Texture2D texture, Color color, int faceTextureSlot) : this(id) {
            Texture = texture;
            Color = color;
            FaceTextureSlot = faceTextureSlot;
        }
    }
}